﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Base.Users
{
	public class User
	{
		#region Members

		private string userName;
		private Role[] rolesField;

		#endregion

		#region Construction

		protected User() { }

		public void Load(string userName)
		{
			this.userName = userName;
		}

		#endregion

		#region Properties

		public string UserName
		{
			get { return this.userName; }
		}

		private string firstName;
		public string FirstName
		{
			get
			{
				return firstName;
			}
			set
			{
				firstName = value;
			}
		}

		private string lastName;
		public string LastName
		{
			get
			{
				return lastName;
			}
			set
			{
				lastName = value;
			}
		}

		private string initials;
		public string Initials
		{
			get
			{
				return initials;
			}
			set
			{
				initials = value;
			}
		}

		private string password;
		public string Password
		{
			get
			{
				return password;
			}
			set
			{
				password = value;
			}
		}

		private bool passwordExpiry;
		public bool PasswordExpiry
		{
			get
			{
				return passwordExpiry;
			}
			set
			{
				passwordExpiry = value;
			}
		}

		private DateTime expiryDate;
		public DateTime ExpiryDate
		{
			get
			{
				return expiryDate;
			}
			set
			{
				expiryDate = value;
			}
		}

		private bool locked;
		public bool Locked
		{
			get
			{
				return locked;
			}
			set
			{
				locked = value;
			}
		}

		/// <remarks/>
		[System.Xml.Serialization.XmlElementAttribute("Roles")]
		public Role[] Roles
		{
			get
			{
				return this.rolesField;
			}
			set
			{
				if ((this.rolesField != value))
				{
					this.rolesField = value;
					this.RaisePropertyChanged("Roles");
				}
			}
		}
		
		#endregion

		#region EventHandler

		public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

		protected void RaisePropertyChanged(string propertyName)
		{
			System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
			if ((propertyChanged != null))
			{
				propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
			}
		}

		#endregion
	}
}
